package com.youme.model.param

import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody

/**
 * Time:4/12/21 9:22 AM
 * Author:
 * Description:
 */
interface ReqParam {
    fun toBody(): RequestBody

    /**
     * @param postId == circleId
     * @param replyId 被回复人id
     * @param commentId 评论的父id
     * @param commentContent 评论内容
     */
    data class Comment(
        @SerializedName("commentContent") val commentContent: String,
        @SerializedName("commentId") val commentId: String,
        @SerializedName("postId") val postId: String,
        @SerializedName("replyId") val replyId: String
    ) : ReqParam {
        override fun toBody(): RequestBody = RequestBody.create("application/json".toMediaType(), Gson().toJson(this))
    }

//    {
//        "content": "string",
//        "location": "string",
//        "picture": "string",
//        "title": "string"
//    }

    data class MomentPublication(
        @SerializedName("content") val content: String,
        @SerializedName("location") val location: String,
        @SerializedName("picture") val picture: String,
        @SerializedName("title") val title: String
    ) : ReqParam {
        override fun toBody(): RequestBody = RequestBody.create("application/json".toMediaType(), Gson().toJson(this))
    }
}